<%@ Page Language="VB" MasterPageFile="~/MasterPageExpandable.master" AutoEventWireup="false" CodeFile="BudgetEditDates.aspx.vb" Inherits="Budget_BudgetEditDates" title="Budget Dates - Conflict" %>
<%@ Register Assembly="InputControls" Namespace="InputControls" TagPrefix="cc2" %>
<%@ Register Assembly="InputControls" Namespace="InputControls" TagPrefix="cc3" %>

<%@ Register Src="~/Budget/BudgetSubNav.ascx" TagName="SubNavPlaceHolder" TagPrefix="uc1" %>
<%@ Register Assembly="InputControls" Namespace="InputControls" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript">
  function setDefaultDates()
  {
  
      var newStartDate=getValue('NewBudgetStartDate');
      var newEndDate=getValue('NewBudgetEndDate');
  
   for (i=0;i<document.forms[0].length;i++)
   {
    if(document.forms[0].elements[i].type=='text')
         {
            var str=document.forms[0].elements[i].id;
            if (str.indexOf('EditStartDateTextBox')>0)
                 document.forms[0].elements[i].value=newStartDate;
           
            if (str.indexOf('EditEndDateTextBox')>0)
                 document.forms[0].elements[i].value=newEndDate;
           
         }
   }
   
  }
  
  function getValue(elementName)
  {
    
       for (i=0;i<document.forms[0].length;i++)
       {
           var str=document.forms[0].elements[i].id;
           if (str.indexOf(elementName)>-1)
           {
               return document.forms[0].elements[i].value;
           }
       }
       return "";
  }
</script>
 <cc1:EditCaseSubNav ID="EditCaseSubNav2" runat="server" InvalidTabs="none" ShowCaseNotes="True" ShowEmployeeInfo="True" ShowLegalGuardianInfo="True" ShowMedicalCareProvider="True" ShowParticipantRepInfo="True" ShowPersonalInfo="True" UseTable="true" Width="862px" />
        <cc3:FinancialSubNav  ID="FinancialSubName" runat="server" InvalidTabs="none" ShowBudgetInfo="True" ShowSubmitSpendingPlan="True" ShowViewSpendingPlan="True" ShowGetSpendingPlan="True" ShowViewMonthlyStatement="True" ShowSubmitMonthlyStatement="True" ShowGetMonthlyStatement="True" ShowHistory="True" ShowAffirmations="true" UseTable="true" Width="862px" style="left: 229px; top: 16px" />
    <h1><a id="pagecontent">Budget Dates - Conflict</a></h1>
    <table align="center" width="600">
    <tr><td colspan="2" class="labelSmallNoWidthOrAlign">The proposed updated budget dates overlap with the dates of associated spending plans.
    Use this page to set dates of budgets and spending plans so that the dates match.</td></tr>
    <tr><td class="labelSmallNoWidthOrAlign">Current Budget Dates:</td><td class="labelSmallNoWidthOrAlign"><asp:Label ID="CurrentBudgetDatesLabel" runat="server" CssClass="labelSmallNoWidthOrAlign"></asp:Label></td></tr>
    <tr><td class="labelSmallNoWidthOrAlign">New Budget Dates:</td><td><asp:TextBox ID="NewBudgetStartDate" runat="server" CssClass="labelSmallNoWidthOrAlign"></asp:TextBox> to <asp:TextBox ID="NewBudgetEndDate" runat="server" CssClass="labelSmallNoWidthOrAlign"></asp:TextBox></td></tr>
    <tr><td></td><td class="labelSmallNoWidthOrAlign"><a href="javascript:setDefaultDates();">Click here</a> to set all spending plan dates the same as budget dates.</td></tr>
    <tr><td></td><td class="labelSmall"><input type="reset" value="Reset Form" /></td></tr>
    </table>
    <span class="tabHeader">Associated Spending Plans</span>
    <asp:GridView ID="SpendingPlansGridView" runat="server" CssClass="gridOffset" Width="825px" AutoGenerateColumns="False" DataKeyNames="SpendingPlanId, SpendingPlanStatusId" CellPadding="5" BorderColor="Gray" BorderStyle="Solid" GridLines="Vertical" EmptyDataText="No spending plans have been posted for this participant." AllowSorting="True">
            <HeaderStyle  CssClass="headerStyle" BackColor="#949FB1" BorderColor="Gray" VerticalAlign="Top" />
            <RowStyle CssClass="columnStyle" />
            <Columns>
                <asp:TemplateField HeaderText="Active">
                  <ItemStyle HorizontalAlign="center" />
                   <ItemTemplate>
                <asp:Image ID="IsActiveImage" runat="server" ImageUrl='<%#GetActiveImage(Eval("IsCurrentlyActive")) %>' />
                </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="DateCreated" ReadOnly="true" HeaderText="Submitted" SortExpression="DateCreated" DataFormatString="{0:MM/dd/yyyy}" />
                <asp:TemplateField HeaderText="Start Date" SortExpression="StartDate">
                    <ItemTemplate>
                    <asp:TextBox ID="EditStartDateTextBox" Columns="12" Width="75" runat="server" Text=' <%#Eval("StartDate", "{0:MM/dd/yyyy}")%>'></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                     <asp:TemplateField HeaderText="End Date" SortExpression="EndDate">
                    <ItemTemplate>
                    <asp:TextBox ID="EditEndDateTextBox" Columns="12" Width="75" runat="server" Text=' <%#Eval("EndDateString")%>'></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                   <asp:TemplateField HeaderText="Status" SortExpression="Status">
                    <ItemTemplate>
                       <a href='SpendingPlanView.aspx?id=<%#Eval("SpendingPlanId") %>'>
                       <span style='color:<%#GetStatusColor(Eval("SpendingPlanStatusId")) %>; text-decoration:underline;' title="Click to view spending plan details.">  <%#Eval("Status")%></span>
                       </a>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="SubmittedBy" ReadOnly="true" HeaderText="Submitted By" SortExpression="SubmittedBy" />
                   <asp:TemplateField HeaderText="Comments" SortExpression="Comments">
                    <ItemTemplate>
                    <a href="javascript:openCommentsWindow('<%#Eval("SpendingPlanId")%>');" title='<%#Replace(Eval("Comments"),"'","&rsquo;") %>'>Comments</a>
                </ItemTemplate>
                   </asp:TemplateField>
                   <asp:BoundField DataField="Version" ReadOnly="true" HeaderText="Version" SortExpression="Version" />
                </Columns>
            <AlternatingRowStyle BackColor="#E8ECF4" />
            <EmptyDataRowStyle CssClass="label" HorizontalAlign="Center" />
        </asp:GridView>
        <asp:Button ID="SubmitButton" runat="server" Text="Save" />
        <asp:Button ID="CancelButton" runat="server" Text="Cancel" />
        <cc1:ValidationErrorSummary ID="ErrorSummary" runat="server" Visible="false" />
</asp:Content>

